/*
 * @Description:
 * @Version: 1.0
 * @Author: Will
 * @Date: 2023-06-15 15:29:48
 * @LastEditors: MarsLay 331412466@qq.com
 * @LastEditTime: 2023-07-04 17:49:20
 * @FilePath: \nanhu-manage-pc\src\main.js
 * Copyright (C) 2023 Will. All rights reserved.
 */
import Vue from "vue";
import App from "./App.vue";
import store from "./store";
//把vuex定义成全局组件
Vue.prototype.$store = store;
// 此处引入定义的路由
import router from "../src/router/index";

Vue.config.productionTip = false;

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
// 全局设置 elementUI的$message的默认显示时间
const messages = ["success", "warning", "info", "error"];
messages.forEach((type) => {
  ElementUI.Message[type] = (options) => {
    if (typeof options === "string") {
      options = {
        message: options,
      };
      options.duration = 1000;
    }
    options.type = type;
    return ElementUI.Message(options);
  };
});
Vue.use(ElementUI);

import { utils } from "./utils/util";
Vue.prototype.$utils = utils;

import "./utils/date-format";

import axios from "axios";
Vue.prototype.$axios = axios;

import checkTimeOut from "./utils/checkTimeOut";
Vue.use(checkTimeOut);

import "./utils/rem";

new Vue({
  router,
  render: (h) => h(App),
}).$mount("#app");
